package com.tsmti.activiti.service.impl;

import com.tsmti.activiti.entity.ExtendActFlowBus;
import com.tsmti.activiti.service.ExtendActFlowBusService;
import com.tsmti.core.common.service.impl.BaseServiceImpl;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Package：com.tsmti.activiti.service.impl
 * @Class：ExtendActFlowBusServiceImpl
 * @Description： TODO
 * @Author：zcw
 * @Date：Created in 2018/8/16 15:31
 * @Company:
 * @Version：
 * @Modified By:
 *
 */
@Service("extendActFlowbusService")
@Transactional(rollbackFor = Exception.class)
public class ExtendActFlowBusServiceImpl extends BaseServiceImpl<ExtendActFlowBus> implements ExtendActFlowBusService {

	@Override
	public ExtendActFlowBus queryByBusIdInsId(String instanceId, String busId) {
		DetachedCriteria flowCriteria = DetachedCriteria.forClass(ExtendActFlowBus.class);
		flowCriteria.add(Restrictions.eq("instanceId",instanceId));
		flowCriteria.add(Restrictions.eq("busId",busId));
		List<ExtendActFlowBus> flowBusList =  list(flowCriteria);
		if(flowBusList !=null && flowBusList.size() >0){
			return flowBusList.get(0);
		}
		return null;
	}
}
